<template>
  <el-table :data="all_materialstock" stripe style="width: 100%" height="100%">
    <el-table-column
      v-for="column in material_stock_define"
      :key="column.code"
      :prop="column.code"
      :label="column.name"
      :width="column.width ? column.width : 100"
      :formatter="
        (row, column, cellValue, index) => {
          return cell_formatter(column, cellValue, material_stock_define)
        }
      "
    />
  </el-table>
</template>
<script lang="ts" setup>
import type { bd_location, bd_material, t_material_stock } from '@/types/basedata'
import { ref, onMounted } from 'vue'
import { fill_ref_info, cell_formatter } from '@/utils/common'
import { material_stock_define, pd_location_storage_define } from '@/meta'
import type { pd_location_storage, pd_qrcode } from '@/types/producedata'
import { useDbStore } from '@/stores/modules/database'
const dbStore = useDbStore()
const tableData = ref<pd_location_storage[]>([])
const all_materialstock = ref<t_material_stock[]>([])
const all_material = ref<bd_material[]>([])
const location_id = ref<string>()
const material_id = ref<string>()
onMounted(() => {
  const tmp = dbStore.materialStock
  fill_ref_info(tmp, material_stock_define)
    .then(() => {
      all_materialstock.value = tmp
    })
    .catch(() => {
      console.log('err')
    })
})
</script>
